package com.ghh.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class SmsDao {

    @Autowired
    private RedisTemplate redisTemplate;

    //模拟存入方法
    public void setSmsToRedis(String phone,String message){
        redisTemplate.boundHashOps("sms").put(phone,message);

    }

    //取出方法
    public String getSmsToRedis(String phone){
        return (String) redisTemplate.boundHashOps("sms").get(phone);
    }

}
